@extends("Admin.Manage.article_manage")

@section("body")
@section("main")
    <div class="col-sm-10">
        <div class="panel panel-default">
            <div class="panel panel-body">
                <button type="button" class="btn btn-success" data-toggle="modal" data-target="#myModala">
                    添加类别
                </button>
                <!-- Modal -->
                <div class="modal fade" id="myModala" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" id="myModalLabel">添加操作窗口</h4>
                            </div>
                            <form action="/user_aClass" method="post">
                                    <div class="col-sm-12">
                                        <label>类名</label>
                                        <input class="form-control" placeholder="" name="class_name" type="text" >
                                    </div>
                                    <div class="col-sm-12">
                                        <label>简介</label>
                                        <input class="form-control" placeholder="" name="class_intro" type="text">
                                        <br \>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                        <button type="submit" class="btn btn-primary">添加</button>
                                        <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                    </div>
                            </form>
                        </div>
                    </div>
                </div>
                @if($inputData==false)
                <table class="table table-bordered">
                    <tr>
                        <th>分类名称</th>
                        <th>分类简介</th>
                        <th>创建时间</th>
                        <th>更新时间</th>
                        <th>操作</th>
                    </tr>
                </table>
                @else
                <table class="table table-bordered">
                    <tr>
                        <th>分类名称</th>
                        <th>分类简介</th>
                        <th>创建时间</th>
                        <th>更新时间</th>
                        <th>操作</th>
                    </tr>
                    @foreach($inputData as $u)
                        <tr style="color:#808080">
                            <th>{{$u->class_name}}</th>
                            <th>{{$u->class_intro}}</th>
                            <th>{{$u->class_create_time}}</th>
                            <th>{{$u->class_update_time}}</th>
                            <th>
                                <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal{{$u->class_id}}">
                                    修改
                                </button>

                                <!-- Modal -->
                                <div class="modal fade" id="myModal{{$u->class_id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                                    <div class="modal-dialog" role="document">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                                <h4 class="modal-title" id="myModalLabel">修改操作窗口</h4>
                                            </div>
                                            <form action="/user_uClass" method="post">
                                                   <div class="col-sm-12">
                                                       <label>类名</label>
                                                       <input class="form-control" placeholder="" name="class_name" type="text" value="{{$u->class_name}}">
                                                   </div>
                                                   <div class="col-sm-12">
                                                       <label>简介</label>
                                                       <input class="form-control" placeholder="" name="class_intro" type="text" value="{{$u->class_intro}}">
                                                       <br \>
                                                   </div>

                                                    <div class="modal-footer">
                                                    <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">关闭</button>
                                                    <button type="submit" class="btn btn-primary btn-sm">修改</button>
                                                    <input type="hidden" name="class_id" value="{{ $u->class_id}}">
                                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                                    </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>


                                <!-- Button trigger modal -->
                                <button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#myModal1{{$u->class_id}}">
                                    删除
                                </button>

                                <!-- Modal -->
                                <div class="modal fade" id="myModal1{{$u->class_id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                                    <div class="modal-dialog" role="document">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                                <h4 class="modal-title" id="myModalLabel">删除操作窗口</h4>
                                            </div>
                                            <div class="modal-body">
                                                确定要删除 "{{$u->class_name}}" 这个类吗?
                                            </div>
                                            <br \>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">关闭</button>
                                                <a href="user_dClass/{{$u->class_id}}" class="btn btn-danger btn-sm">确定</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </th>
                        </tr>
                    @endforeach
                </table>
                    <div>
                        <b>当前第 {{$nowPage}} 页 | 共 {{$allPage}} 页</b>
                    </div>
                    <div class="col-sm-4 col-sm-offset-4">
                        {!! $inputData->links() !!}
                    </div>
                    @endif
            </div>
        </div>
    </div>
@append
@append